package OfferLanQiaoBei.a_13届蓝桥真题;

import java.util.*;
import java.io.*;

public class d最少刷题数Other {
    public static void main(String[] args) throws IOException {
        String[] brs;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        // input
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n + 1];
        int[] b = new int[n + 1];
        int[] res = new int[n + 1];
        brs = br.readLine().split(" ");
        for (int i = 1; i <= n; i++) {  // ATTENTION: start from 1 !!!
            a[i] = b[i] = Integer.parseInt(brs[i - 1]);
        }
        Arrays.sort(b, 1, n + 1);

        // find the median
        int len = n;
        int median = b[len / 2 + 1];

        // binary search to find the start and the end index of median in b[]
        int st, ed;
        int l = 1, r = n;
        while (l < r) {
            int mid = l + r >> 1;
            if (b[mid] >= median) r = mid;
            else l = mid + 1;
        }
        st = l;
        l = 1; r = n;
        while (l < r) {
            int mid = l + r + 1 >> 1;
            if (b[mid] <= median) l = mid;
            else r = mid - 1;
        }
        ed = l;
        // the num of smaller and bigger than median
        int small = st - 1, big = len - ed;

        // process data
        for (int i = 1; i <= n; i++) {
            // judge
            // 1. a[i] > median
            if (a[i] > median) continue;
            // 2. a[i] = median
            else if (a[i] == median) {
                if (big <= small) continue;
                else res[i] = 1;    // only need to add 1
            }
            // 3. d[i] < median
            else {
                if (small > big) res[i] = median - a[i];
                else res[i] = median - a[i] + 1;
            }
        }

        // output
        for (int i = 1; i <= n; i++) {
            bw.write(res[i] + " ");
        }


        bw.flush();
        bw.close();
        br.close();
    }
}
